﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Inovout
{
    public class NameObjectKey
    {
        private string name;
        private object owner;

        private int hashCode;
        public NameObjectKey(string name, object owner)
        {
            ArgumentAssert.IsNotDefault(name, "name");
            ArgumentAssert.IsNotNull(owner, "owner");
            this.name = name;
            this.owner = owner;

            hashCode = name.GetHashCode() ^ owner.GetHashCode();
        }
        public override int GetHashCode()
        {
            return hashCode;
        }
        private bool Equals(NameObjectKey other)
        {
            return (other!=null)&&(this.name.Equals(other.name) && (this.owner == other.owner));
        }


        public override bool Equals(object obj)
        {
            return (obj != null) && this.Equals(obj as NameObjectKey);
        }
    }

}
